int cmp(const void* a, const void* b)
{
	return ((*((int**)a))[0] > (*((int**)b))[0]);


}

int findMinArrowShots(int** points, int pointsSize, int* pointsColSize)
{
	if (pointsSize == 0)return 0;
	qsort(points, pointsSize, sizeof(points[0]), cmp);
	int ret = 1;

	for (int i = 1; i < pointsSize; i++)
	{
		if (points[i - 1][1] < points[i][0])
			ret++;
		else
		{
			points[i][1] = points[i - 1][1] > points[i][1] ? points[i][1] : points[i - 1][1];

		}

	}
	return ret;








}
int cmp(const void* a, const void* b)
{
	return ((*((int**)a))[0] > (*((int**)b))[0]);


}



int eraseOverlapIntervals(int** intervals, int intervalsSize, int* intervalsColSize) {
	qsort(intervals, intervalsSize, sizeof(intervals[0]), cmp);
	int cnt = 0;
	for (int i = 1; i < intervalsSize; i++)
	{
		if (intervals[i - 1][1] <= intervals[i][0])
		{
		}
		else
		{
			cnt++;
			intervals[i][1] = intervals[i][1] > intervals[i - 1][1] ? intervals[i - 1][1] : intervals[i][1];


		}







	}
	return cnt;


}int* partitionLabels(char* s, int* returnSize) {
	int hash[27] = { 0 };
	int len = strlen(s);
	for (int i = 0; i < len; i++)
	{
		hash[s[i] - 'a'] = i;


	}
	int k = 0;
	*returnSize = len;
	int* a = (int*)malloc(*returnSize * sizeof(int));
	int left = 0; int right = 0;
	for (int i = 0; i < len; i++)
	{
		right = right > hash[s[i] - 'a'] ? right : hash[s[i] - 'a'];
		if (i == right)
		{
			a[k++] = right - left + 1;
			left = i + 1;
		}
	}
	*returnSize = k;
	return a;


}